<?php
class Login_model extends Model{

    var $username   = '';
    var $password 	= '';
    var $errmsg    	= '';

    function Login_model(){
        parent::Model();
    }
    function checklogin(){
    	if($this->input->post('hidden_status') && $this->input->post('hidden_status')=='login'){
    		$this->username = $this->input->post('txt_username');
    		$this->password = $this->input->post('txt_password');    		
    		$query = $this->db->get_where('users',array('username'=>$this->username,'password'=>md5($this->password)));
    		if($query->num_rows()){ 
				$this->db->where('username',$this->username);
				$this->db->update('users',array('time_expire'=>time()));
				set_cookie('username_admin',$this->username,0,'','/','');					
    		}
    		$this->errmsg = !$query->num_rows()?lang('login_invalidusername'):'';
    		return $query->num_rows()>0;
    	}
    	return false;
    }    
}

/* End of file lgoin_model.php */
/* Location: ./system/application/admin/controllers/login_model.php */